- Notifications
You must be signed in to change notification settings - Fork 849
/
Copy pathOML4SQL Statistical Functions.dsnb
executable file
·1 lines (1 loc) · 70.7 KB
/
OML4SQL Statistical Functions.dsnb
1
[{"layout":null,"template":null,"templateConfig":null,"name":"OML4SQL Statistical Functions","description":null,"readOnly":false,"type":"low","paragraphs":[{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# OML4SQL Statistical Functions","","In this notebook, you will use the SH schema data to to explore descriptive and comparative statistics performed inside Oracle Autonomous Database. For the machine learning examples, please see companion notebooks.","","Copyright (c) 2024 Oracle Corporation ","###### <a href=\"https://oss.oracle.com/licenses/upl/\" onclick=\"return ! window.open('https://oss.oracle.com/licenses/upl/');\">The Universal Permissive License (UPL), Version 1.0<\/a>","---"],"enabled":true,"result":{"startTime":1715728480473,"interpreter":"md.low","endTime":1715728480536,"results":[{"message":"<h1 id=\"oml4sql-statistical-functions\">OML4SQL Statistical Functions<\/h1>\n<p>In this notebook, you will use the SH schema data to to explore descriptive and comparative statistics performed inside Oracle Autonomous Database. For the machine learning examples, please see companion notebooks.<\/p>\n<p>Copyright (c) 2024 Oracle Corporation<\/p>\n<h6 id=\"the-universal-permissive-license-upl-version-10\"><a href=\"https://oss.oracle.com/licenses/upl/\" onclick=\"return ! window.open('https://oss.oracle.com/licenses/upl/');\">The Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n<hr />\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":9,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","<dl>","<img src=\"http://www.oracle.com/technetwork/database/options/advanced-analytics/statistics-5663173.jpg\" alt=\"OML Notebooks\" width=\"270\"/>","<\/dl>"],"enabled":true,"result":{"startTime":1715728480615,"interpreter":"md.low","endTime":1715728480675,"results":[{"message":"<dl>\n<img src=\"http://www.oracle.com/technetwork/database/options/advanced-analytics/statistics-5663173.jpg\" alt=\"OML Notebooks\" width=\"270\"/>\n<\/dl>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":3,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"For more information...","message":["%md ","","* <a href=\"https://docs.oracle.com/en/cloud/paas/autonomous-data-warehouse-cloud/index.html\" target=\"_blank\">Oracle ADB Documentation<\/a>","* <a href=\"https://github.com/oracle-samples/oracle-db-examples/tree/main/machine-learning\" target=\"_blank\">OML folder on Oracle GitHub<\/a>","* <a href=\"https://www.oracle.com/machine-learning\" target=\"_blank\">OML Web Page<\/a>","* <a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4sql/23/dmprg/sql-statistical-functions.html\" target=\"_blank\">Statistical Function Documentation<\/a>"],"enabled":true,"result":{"startTime":1715728480774,"interpreter":"md.low","endTime":1715728480832,"results":[{"message":"<ul>\n<li><a href=\"https://docs.oracle.com/en/cloud/paas/autonomous-data-warehouse-cloud/index.html\" target=\"_blank\">Oracle ADB Documentation<\/a><\/li>\n<li><a href=\"https://github.com/oracle-samples/oracle-db-examples/tree/main/machine-learning\" target=\"_blank\">OML folder on Oracle GitHub<\/a><\/li>\n<li><a href=\"https://www.oracle.com/machine-learning\" target=\"_blank\">OML Web Page<\/a><\/li>\n<li><a href=\"https://docs.oracle.com/en/database/oracle/machine-learning/oml4sql/23/dmprg/sql-statistical-functions.html\" target=\"_blank\">Statistical Function Documentation<\/a><\/li>\n<\/ul>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display SH.COUNTRIES data","message":["%sql","","SELECT * FROM SH.COUNTRIES","FETCH FIRST 10 ROWS ONLY"],"enabled":true,"result":{"startTime":1715728480910,"interpreter":"sql.low","endTime":1715728480983,"results":[{"message":"COUNTRY_ID\tCOUNTRY_ISO_CODE\tCOUNTRY_NAME\tCOUNTRY_SUBREGION\tCOUNTRY_SUBREGION_ID\tCOUNTRY_REGION\tCOUNTRY_REGION_ID\tCOUNTRY_TOTAL\tCOUNTRY_TOTAL_ID\tCOUNTRY_NAME_HIST\n52771\tCN\tChina\tAsia\t52793\tAsia\t52802\tWorld total\t52806\t\n52781\tIN\tIndia\tAsia\t52793\tAsia\t52802\tWorld total\t52806\t\n52782\tJP\tJapan\tAsia\t52793\tAsia\t52802\tWorld total\t52806\t\n52783\tMY\tMalaysia\tAsia\t52793\tAsia\t52802\tWorld total\t52806\t\n52769\tSG\tSingapore\tAsia\t52793\tAsia\t52802\tWorld total\t52806\t\n52791\tZA\tSouth Africa\tAfrica\t52792\tAfrica\t52800\tWorld total\t52806\t\n52774\tAU\tAustralia\tAustralia\t52794\tOceania\t52805\tWorld total\t52806\t\n52785\tNZ\tNew Zealand\tAustralia\t52794\tOceania\t52805\tWorld total\t52806\t\n52787\tSA\tSaudi Arabia\tMiddle East\t52796\tMiddle East\t52804\tWorld total\t52806\t\n52786\tPL\tPoland\tEastern Europe\t52795\tEurope\t52803\tWorld total\t52806\t\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display SH.CUSTOMERS data","message":["%sql","","SELECT * FROM SH.CUSTOMERS","FETCH FIRST 10 ROWS ONLY"],"enabled":true,"result":{"startTime":1715728481056,"interpreter":"sql.low","endTime":1715728481129,"results":[{"message":"CUST_ID\tCUST_FIRST_NAME\tCUST_LAST_NAME\tCUST_GENDER\tCUST_YEAR_OF_BIRTH\tCUST_MARITAL_STATUS\tCUST_STREET_ADDRESS\tCUST_POSTAL_CODE\tCUST_CITY\tCUST_CITY_ID\tCUST_STATE_PROVINCE\tCUST_STATE_PROVINCE_ID\tCOUNTRY_ID\tCUST_MAIN_PHONE_NUMBER\tCUST_INCOME_LEVEL\tCUST_CREDIT_LIMIT\tCUST_EMAIL\tCUST_TOTAL\tCUST_TOTAL_ID\tCUST_SRC_ID\tCUST_EFF_FROM\tCUST_EFF_TO\tCUST_VALID\n49671\tAbigail\tRuddy\tM\t1976\tmarried\t27 North Sagadahoc Boulevard\t60332\tEde\t51442\tGelderland\t52610\t52770\t519-236-6123\tG: 130,000 - 149,999\t1500\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tI\n3228\tAbigail\tRuddy\tM\t1964\t\t37 West Geneva Street\t55406\tHoofddorp\t51669\tNoord-Holland\t52683\t52770\t327-194-5008\tG: 130,000 - 149,999\t7000\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tA\n6783\tAbigail\tRuddy\tM\t1942\tsingle\t47 Toa Alta Road\t34077\tSchimmert\t52297\tLimburg\t52646\t52770\t288-613-9676\tG: 130,000 - 149,999\t11000\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tI\n10338\tAbigail\tRuddy\tM\t1977\tmarried\t47 South Kanabec Road\t72996\tScheveningen\t52296\tZuid-Holland\t52771\t52770\t222-269-1259\tG: 130,000 - 149,999\t1500\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tI\n13894\tAbigail\tRuddy\tM\t1949\t\t57 North 3rd Drive\t67644\tJoinville\t51698\tSanta Catarina\t52734\t52775\t675-133-2226\tG: 130,000 - 149,999\t9000\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tI\n17449\tAbigail\tRuddy\tM\t1950\tsingle\t67 East Mcintosh Avenue\t83786\tNagoya\t51971\tAichi\t52543\t52782\t183-207-2933\tG: 130,000 - 149,999\t9000\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tA\n21005\tAbigail\tRuddy\tM\t1946\tmarried\t77 Bradford Avenue\t52773\tSantos\t52293\tSao Paulo\t52735\t52775\t129-379-7148\tG: 130,000 - 149,999\t3000\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tI\n24561\tAbigail\tRuddy\tM\t1978\t\t77 North Packard Avenue\t37400\tYokohama\t52526\tKanagawa\t52634\t52782\t689-236-7611\tG: 130,000 - 149,999\t7000\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tA\n28116\tAbigail\tRuddy\tM\t1949\tsingle\t87 West Coshocton Avenue\t71349\tHaarlem\t51644\tNoord-Holland\t52683\t52770\t208-194-6025\tG: 130,000 - 149,999\t11000\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tI\n31671\tAbigail\tRuddy\tM\t1951\tmarried\t97 Sagadahoc Avenue\t55056\tBolton\t51205\tEngland - Greater Manchester\t52590\t52789\t391-613-8000\tG: 130,000 - 149,999\t1500\tRuddy@company.example.com\tCustomer total\t52772\t\t1998-01-01 00:00:00\t\tI\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Display mode value for CUST_MARITAL_STATUS","message":["%sql ","","SELECT STATS_MODE(CUST_MARITAL_STATUS) ","FROM SH.CUSTOMERS"],"enabled":true,"result":{"startTime":1715728481218,"interpreter":"sql.low","endTime":1715728481313,"results":[{"message":"STATS_MODE(CUST_MARITAL_STATUS)\nsingle\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Display median value for CUST_CREDIT_LIMIT","message":["%sql","","SELECT MEDIAN(CUST_CREDIT_LIMIT) ","FROM SH.CUSTOMERS;"],"enabled":true,"result":{"startTime":1715728481389,"interpreter":"sql.low","endTime":1715728481481,"results":[{"message":"MEDIAN(CUST_CREDIT_LIMIT)\n7000\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display median CUST_CREDIT_LIMIT grouped by CUST_MARITAL_STATUS in descendig order","message":["%sql ","","SELECT CUST_MARITAL_STATUS, MEDIAN(CUST_CREDIT_LIMIT) ","FROM SH.CUSTOMERS ","GROUP BY CUST_MARITAL_STATUS","FETCH FIRST 10 ROWS ONLY"],"enabled":true,"result":{"startTime":1715728481560,"interpreter":"sql.low","endTime":1715728481654,"results":[{"message":"CUST_MARITAL_STATUS\tMEDIAN(CUST_CREDIT_LIMIT)\nDivorc.\t9000\nMabsent\t9000\nMar-AF\t11000\nMarried\t9000\nNeverM\t9000\nSepar.\t9000\nWidowed\t7000\ndivorced\t7000\nmarried\t5000\nsingle\t7000\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display mean CUST_CREDIT_LIMIT grouped by CUST_MARITAL_STATUS in descending order","message":["%sql ","SELECT CUST_MARITAL_STATUS, ROUND(AVG(CUST_CREDIT_LIMIT),2)","FROM SH.CUSTOMERS ","GROUP BY CUST_MARITAL_STATUS ","ORDER BY AVG(CUST_CREDIT_LIMIT) DESC","FETCH FIRST 10 ROWS ONLY"],"enabled":true,"result":{"startTime":1715728481741,"interpreter":"sql.low","endTime":1715728481816,"results":[{"message":"CUST_MARITAL_STATUS\tROUND(AVG(CUST_CREDIT_LIMIT),2)\nMar-AF\t10333.33\nSepar.\t8279.85\nMabsent\t8233.33\nNeverM\t8168.66\nMarried\t7800.64\nDivorc.\t7768.29\n\t7365.56\nWidowed\t7202.21\nwidow\t6400\nsingle\t6349.95\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":6,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"STATS_MODE with dynamic data","message":["%md","Note that STATS_MODE can only work with materialized tables, instead of dynamic data like a view or tables joined together. In that case, we recommend using the max count. For example, in the following paragraph we want to find the mode of the *COUNTRY_NAME*, which is obtained from joining two tables. In this case, it is better to achieve that by taking the max count. "],"enabled":true,"result":{"startTime":1715728481892,"interpreter":"md.low","endTime":1715728481951,"results":[{"message":"<p>Note that STATS_MODE can only work with materialized tables, instead of dynamic data like a view or tables joined together. In that case, we recommend using the max count. For example, in the following paragraph we want to find the mode of the <em>COUNTRY_NAME<\/em>, which is obtained from joining two tables. In this case, it is better to achieve that by taking the max count.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Find mode of COUNTRY_NAME, i.e., country with most customers","message":["%sql","SELECT COUNTRY_NAME,"," RANK","FROM ("," SELECT COUNTRY_NAME, "," ROW_NUMBER() OVER( ORDER BY COUNT DESC) RANK"," FROM ("," SELECT COUNTRY_NAME, COUNT(*) COUNT"," FROM SH.CUSTOMERS CUST, SH.COUNTRIES CO"," WHERE CUST.COUNTRY_ID = CO.COUNTRY_ID"," GROUP BY COUNTRY_NAME ) A ) B","WHERE RANK =1"],"enabled":true,"result":{"startTime":1715728482027,"interpreter":"sql.low","endTime":1715728482103,"results":[{"message":"COUNTRY_NAME\tRANK\nUnited States of America\t1\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":4,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display counts of COUNTRY_NAME to highlight mode visually","message":["%sql","","SELECT COUNTRY_NAME, COUNT(*) COUNT","FROM SH.CUSTOMERS CUST, SH.COUNTRIES CO","WHERE CUST.COUNTRY_ID = CO.COUNTRY_ID","GROUP BY COUNTRY_NAME","ORDER BY COUNT DESC","FETCH FIRST 10 ROWS ONLY"],"enabled":true,"result":{"startTime":1715728482180,"interpreter":"sql.low","endTime":1715728482253,"results":[{"message":"COUNTRY_NAME\tCOUNT\nUnited States of America\t18520\nGermany\t8173\nItaly\t7780\nUnited Kingdom\t7557\nFrance\t3833\nSpain\t2039\nCanada\t2010\nBrazil\t832\nAustralia\t831\nChina\t712\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":8,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Check 1st, 2nd, and 3rd quantile of amount sold - PERCENTILE_CONT resolves ties by interpolation. PERCENTILE_DISC outputs first value when seeing a tie","message":["%sql","SELECT PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY AMOUNT_SOLD) \"First Quantile cont\","," PERCENTILE_DISC(0.25) WITHIN GROUP (ORDER BY AMOUNT_SOLD) \"First Quantile disc\","," PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY AMOUNT_SOLD) \"Second Quantile cont\","," PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY AMOUNT_SOLD) \"Second Quantile disc\","," PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY AMOUNT_SOLD) \"Third Quantile cont\","," PERCENTILE_DISC(0.75) WITHIN GROUP (ORDER BY AMOUNT_SOLD) \"Third Quantile disc\"","FROM SH.SALES"],"enabled":true,"result":{"startTime":1715728482328,"interpreter":"sql.low","endTime":1715728482827,"results":[{"message":"First Quantile cont\tFirst Quantile disc\tSecond Quantile cont\tSecond Quantile disc\tThird Quantile cont\tThird Quantile disc\n17.38\t17.38\t34.24\t34.24\t53.89\t53.89\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using a t-test","message":["%md","#### Use the SQL t-test function for performing a t-test in-database using the SH.SALES and SH.CUSTOMERS tables. ","","See more information at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_T_TEST_.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_T_TEST_.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_T_TEST_.html <\/a>","","The t-test measures the significance of a difference of means. You use it to compare the means of two groups or the means of one group with a constant. A t-test is any statistical hypothesis test in which the test statistic follows a Student's t distribution under the null hypothesis. It can be used to determine if two sets of data are significantly different from each other, and is most commonly applied when the test statistic would follow a Normal distribution if the value of a scaling term in the test statistic were known. When the scaling term is unknown and is replaced by an estimate based on the data, the test statistic (under certain conditions) follows a Student's t distribution. ","For more details on the background of t-tests , see <a href=\"https://en.wikipedia.org/wiki/Student%27s_t-test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Student%27s_t-test');\"> https://en.wikipedia.org/wiki/Student%27s_t-test <\/a>","","`Hint`: P_Values < 0.05 show statistically significantly differences (over 95% confidence) in the amounts purchased by men vs. women","`Hint`: NaN is used for display when there are nulls and/or empty"],"enabled":true,"result":{"startTime":1715728482907,"interpreter":"md.low","endTime":1715728482967,"results":[{"message":"<h4 id=\"use-the-sql-t-test-function-for-performing-a-t-test-in-database-using-the-shsales-and-shcustomers-tables\">Use the SQL t-test function for performing a t-test in-database using the SH.SALES and SH.CUSTOMERS tables.<\/h4>\n<p>See more information at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_T_TEST_.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_T_TEST_.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_T_TEST_.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_T_TEST_.html<\/a> <\/a><\/p>\n<p>The t-test measures the significance of a difference of means. You use it to compare the means of two groups or the means of one group with a constant. A t-test is any statistical hypothesis test in which the test statistic follows a Student's t distribution under the null hypothesis. It can be used to determine if two sets of data are significantly different from each other, and is most commonly applied when the test statistic would follow a Normal distribution if the value of a scaling term in the test statistic were known. When the scaling term is unknown and is replaced by an estimate based on the data, the test statistic (under certain conditions) follows a Student's t distribution.\nFor more details on the background of t-tests , see <a href=\"https://en.wikipedia.org/wiki/Student%27s_t-test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Student%27s_t-test');\"> <a href=\"https://en.wikipedia.org/wiki/Student%27s_t-test\">https://en.wikipedia.org/wiki/Student%27s_t-test<\/a> <\/a><\/p>\n<p><code>Hint<\/code>: P_Values < 0.05 show statistically significantly differences (over 95% confidence) in the amounts purchased by men vs. women\n<code>Hint<\/code>: NaN is used for display when there are nulls and/or empty<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Compare average amount SOLD_TO_MEN versus average amount SOLD_TO_WOMEN grouped by INCOME_LEVEL - determine if significantly different","message":["%sql ","","SELECT SUBSTR(CUST_INCOME_LEVEL,1,22) INCOME_LEVEL, "," ROUND(AVG(DECODE(CUST_GENDER,'M',AMOUNT_SOLD,NULL)),2) SOLD_TO_MEN, ","\t ROUND(AVG(DECODE(CUST_GENDER,'F',AMOUNT_SOLD,NULL)),2) SOLD_TO_WOMEN, ","\t ROUND(STATS_T_TEST_INDEP(CUST_GENDER, AMOUNT_SOLD, 'STATISTIC','F'),2) T_OBSERVED, ","\t ROUND(STATS_T_TEST_INDEP(CUST_GENDER, AMOUNT_SOLD),2) TWO_SIDED_P_VALUE","FROM SH.CUSTOMERS C, SH.SALES S ","WHERE C.CUST_ID=S.CUST_ID ","GROUP BY CUST_INCOME_LEVEL ","ORDER BY 1"],"enabled":true,"result":{"startTime":1715728483047,"interpreter":"sql.low","endTime":1715728483947,"results":[{"message":"INCOME_LEVEL\tSOLD_TO_MEN\tSOLD_TO_WOMEN\tT_OBSERVED\tTWO_SIDED_P_VALUE\nA: Below 30,000\t105.28\t99.43\t-1.99\t0.05\nB: 30,000 - 49,999\t102.6\t109.83\t3.04\t0\nC: 50,000 - 69,999\t105.63\t110.13\t2.36\t0.02\nD: 70,000 - 89,999\t106.63\t110.47\t2.28\t0.02\nE: 90,000 - 109,999\t103.4\t101.61\t-1.25\t0.21\nF: 110,000 - 129,999\t106.76\t105.98\t-0.6\t0.55\nG: 130,000 - 149,999\t108.88\t107.31\t-0.85\t0.39\nH: 150,000 - 169,999\t110.99\t107.15\t-1.91\t0.06\nI: 170,000 - 189,999\t102.81\t107.44\t2.18\t0.03\nJ: 190,000 - 249,999\t108.04\t115.34\t2.58\t0.01\nK: 250,000 - 299,999\t112.38\t108.2\t-1.41\t0.16\nL: 300,000 and above\t120.97\t112.22\t-2.06\t0.04\n\t107.12\t113.8\t0.69\t0.49\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Compare average amount SOLD_TO_MEN versus average amount SOLD_TO_WOMEN grouped by INCOME_LEVEL - determine if significantly different","message":["%sql ","","SELECT SUBSTR(CUST_INCOME_LEVEL,1,22) INCOME_LEVEL, "," ROUND(AVG(DECODE(CUST_GENDER,'M',AMOUNT_SOLD,NULL)),2) SOLD_TO_MEN, ","\t ROUND(AVG(DECODE(CUST_GENDER,'F',AMOUNT_SOLD,NULL)),2) SOLD_TO_WOMEN, ","\t ROUND(STATS_T_TEST_INDEP(CUST_GENDER, AMOUNT_SOLD, 'STATISTIC','F'),2) T_OBSERVED, ","\t ROUND(STATS_T_TEST_INDEP(CUST_GENDER, AMOUNT_SOLD),2) TWO_SIDED_P_VALUE","FROM SH.CUSTOMERS C, SH.SALES S ","WHERE C.CUST_ID=S.CUST_ID ","GROUP BY CUST_INCOME_LEVEL ","ORDER BY TWO_SIDED_P_VALUE DESC"],"enabled":true,"result":{"startTime":1715728484028,"interpreter":"sql.low","endTime":1715728485024,"results":[{"message":"INCOME_LEVEL\tSOLD_TO_MEN\tSOLD_TO_WOMEN\tT_OBSERVED\tTWO_SIDED_P_VALUE\nF: 110,000 - 129,999\t106.76\t105.98\t-0.6\t0.55\n\t107.12\t113.8\t0.69\t0.49\nG: 130,000 - 149,999\t108.88\t107.31\t-0.85\t0.39\nE: 90,000 - 109,999\t103.4\t101.61\t-1.25\t0.21\nK: 250,000 - 299,999\t112.38\t108.2\t-1.41\t0.16\nH: 150,000 - 169,999\t110.99\t107.15\t-1.91\t0.06\nA: Below 30,000\t105.28\t99.43\t-1.99\t0.05\nL: 300,000 and above\t120.97\t112.22\t-2.06\t0.04\nI: 170,000 - 189,999\t102.81\t107.44\t2.18\t0.03\nC: 50,000 - 69,999\t105.63\t110.13\t2.36\t0.02\nD: 70,000 - 89,999\t106.63\t110.47\t2.28\t0.02\nJ: 190,000 - 249,999\t108.04\t115.34\t2.58\t0.01\nB: 30,000 - 49,999\t102.6\t109.83\t3.04\t0\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Note: NaN is displayed above where INCOME_LEVEL is NULL - let's display those records","message":["%sql","","SELECT CUST_ID, CUST_FIRST_NAME, CUST_LAST_NAME, CUST_INCOME_LEVEL ","FROM SH.CUSTOMERS ","WHERE CUST_INCOME_LEVEL IS NULL","FETCH FIRST 10 ROWS ONLY"],"enabled":true,"result":{"startTime":1715728485112,"interpreter":"sql.low","endTime":1715728485190,"results":[{"message":"CUST_ID\tCUST_FIRST_NAME\tCUST_LAST_NAME\tCUST_INCOME_LEVEL\n803\tThatcher\tTyler\t\n963\tFabian\tLusk\t\n1043\tForrest\tBanfield\t\n723\tTrevor\tNielley\t\n270\tVerna\tWalsh\t\n590\tWadswworth\tWhite\t\n1017\tWashington\tDally\t\n31\tWilla\tFitz\t\n297\tJacinta\tMathews\t\n617\tJed\tHardy\t\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using an F-test","message":["%md","#### Use an F-test to compare whether variances of two groups are significantly different","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_F_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_F_TEST.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_F_TEST.html <\/a>","","The F-test tests whether variances of two groups are significantly different. The null hypothesis is that the variances of two groups are the same. The observed value of *F* is the ratio of one variance to the other, so values very different from 1 usually indicate significant differences. ","If the p value is very small (such as p < 0.05), then we reject the null hypothesis and we say that it is statistically significant (at more than 95% confidence) that the variances of the two groups are different.","","For more details on the background of F-Tests, see <a href=\"https://en.wikipedia.org/wiki/F-test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/F-test');\">https://en.wikipedia.org/wiki/F-test<\/a>","","In the following example, we compare the credit limit in two gender groups. We use F-test to check if the variances of the two gropus are the same."],"enabled":true,"result":{"startTime":1715728485269,"interpreter":"md.low","endTime":1715728485334,"results":[{"message":"<h4 id=\"use-an-f-test-to-compare-whether-variances-of-two-groups-are-significantly-different\">Use an F-test to compare whether variances of two groups are significantly different<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_F_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_F_TEST.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_F_TEST.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_F_TEST.html<\/a> <\/a><\/p>\n<p>The F-test tests whether variances of two groups are significantly different. The null hypothesis is that the variances of two groups are the same. The observed value of <em>F<\/em> is the ratio of one variance to the other, so values very different from 1 usually indicate significant differences.\nIf the p value is very small (such as p < 0.05), then we reject the null hypothesis and we say that it is statistically significant (at more than 95% confidence) that the variances of the two groups are different.<\/p>\n<p>For more details on the background of F-Tests, see <a href=\"https://en.wikipedia.org/wiki/F-test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/F-test');\"><a href=\"https://en.wikipedia.org/wiki/F-test\">https://en.wikipedia.org/wiki/F-test<\/a><\/a><\/p>\n<p>In the following example, we compare the credit limit in two gender groups. We use F-test to check if the variances of the two gropus are the same.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Compare variances of cust_credit_limit for men and women - determine if variances are significantly different","message":["%sql","","SELECT ROUND(VARIANCE(DECODE(CUST_GENDER, 'M', CUST_CREDIT_LIMIT, NULL)),2) VAR_MEN,"," ROUND(VARIANCE(DECODE(CUST_GENDER, 'F', CUST_CREDIT_LIMIT, NULL)),2) VAR_WOMEN,"," ROUND(STATS_F_TEST(CUST_GENDER, CUST_CREDIT_LIMIT, 'STATISTIC', 'F'),2) F_STATISTIC,"," ROUND(STATS_F_TEST(CUST_GENDER, CUST_CREDIT_LIMIT),2) TWO_SIDED_P_VALUE"," FROM SH.CUSTOMERS;"],"enabled":true,"result":{"startTime":1715728485417,"interpreter":"sql.low","endTime":1715728485512,"results":[{"message":"VAR_MEN\tVAR_WOMEN\tF_STATISTIC\tTWO_SIDED_P_VALUE\n12879896.68\t13046865.01\t1.01\t0.31\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Conclusion for F-test","message":["%md","The p-value is greater than 0.05, so the result above shows that the variances of the CUST_CREDIT_LIMIT for men and women has no statistical difference."],"enabled":true,"result":{"startTime":1715728485591,"interpreter":"md.low","endTime":1715728485650,"results":[{"message":"<p>The p-value is greater than 0.05, so the result above shows that the variances of the CUST_CREDIT_LIMIT for men and women has no statistical difference.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using one way ANOVA test","message":["%md","#### Using one way ANOVA (analysis of variance) test to verify differences in means (for groups or variables) for statistical significance","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_ONE_WAY_ANOVA.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_ONE_WAY_ANOVA.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_ONE_WAY_ANOVA.html <\/a>","","The one-way analysis of variance function (STATS_ONE_WAY_ANOVA) tests differences in means (for groups or variables) for statistical significance by comparing two different estimates of variance. One estimate is based on the variances within each group or category. This is known as the mean squares within or mean square error. The other estimate is based on the variances among the means of the groups. This is known as the mean squares between. If the means of the groups are significantly different, then the mean squares between will be larger than expected and will not match the mean squares within. If the mean squares of the groups are consistent, then the two variance estimates will be about the same.","","For more information and background on ANOVA, see <a href=\"https://en.wikipedia.org/wiki/One-way_analysis_of_variance\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/One-way_analysis_of_variance');\"> https://en.wikipedia.org/wiki/One-way_analysis_of_variance <\/a>","","In the following example, we apply the one way ANOVA to test for each gender, whether the amount sold varies according to the income level. "],"enabled":true,"result":{"startTime":1715728485735,"interpreter":"md.low","endTime":1715728485797,"results":[{"message":"<h4 id=\"using-one-way-anova-analysis-of-variance-test-to-verify-differences-in-means-for-groups-or-variables-for-statistical-significance\">Using one way ANOVA (analysis of variance) test to verify differences in means (for groups or variables) for statistical significance<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_ONE_WAY_ANOVA.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_ONE_WAY_ANOVA.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_ONE_WAY_ANOVA.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_ONE_WAY_ANOVA.html<\/a> <\/a><\/p>\n<p>The one-way analysis of variance function (STATS_ONE_WAY_ANOVA) tests differences in means (for groups or variables) for statistical significance by comparing two different estimates of variance. One estimate is based on the variances within each group or category. This is known as the mean squares within or mean square error. The other estimate is based on the variances among the means of the groups. This is known as the mean squares between. If the means of the groups are significantly different, then the mean squares between will be larger than expected and will not match the mean squares within. If the mean squares of the groups are consistent, then the two variance estimates will be about the same.<\/p>\n<p>For more information and background on ANOVA, see <a href=\"https://en.wikipedia.org/wiki/One-way_analysis_of_variance\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/One-way_analysis_of_variance');\"> <a href=\"https://en.wikipedia.org/wiki/One-way_analysis_of_variance\">https://en.wikipedia.org/wiki/One-way_analysis_of_variance<\/a> <\/a><\/p>\n<p>In the following example, we apply the one way ANOVA to test for each gender, whether the amount sold varies according to the income level.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Apply one way ANOVA test to different income levels and the amount sold, for each gender group.","message":["%sql","","SELECT CUST_GENDER,"," ROUND(STATS_ONE_WAY_ANOVA(CUST_INCOME_LEVEL, AMOUNT_SOLD, 'MEAN_SQUARES_BETWEEN'),2) MEAN_SQUARES_BETWEEN ,"," ROUND(STATS_ONE_WAY_ANOVA(CUST_INCOME_LEVEL, AMOUNT_SOLD, 'MEAN_SQUARES_WITHIN'),2) MEAN_SQUARES_WITHIN,"," STATS_ONE_WAY_ANOVA(CUST_INCOME_LEVEL, AMOUNT_SOLD, 'SIG') P_VALUE"," FROM SH.CUSTOMERS C, SH.SALES S"," WHERE C.CUST_ID = S.CUST_ID"," GROUP BY CUST_GENDER;"],"enabled":true,"result":{"startTime":1715728485875,"interpreter":"sql.low","endTime":1715728486601,"results":[{"message":"CUST_GENDER\tMEAN_SQUARES_BETWEEN\tMEAN_SQUARES_WITHIN\tP_VALUE\nF\t379803.89\t67878.25\t0.0000000047839510702026533\nM\t624317.68\t67228.52\t0.000000000000000067139449119250277\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Conclusion of one way ANOVA test","message":["%md","From ANOVA test result, we can see that for each gender group, the mean value of the amount sold is significantly different across income levels. "],"enabled":true,"result":{"startTime":1715728486687,"interpreter":"md.low","endTime":1715728486744,"results":[{"message":"<p>From ANOVA test result, we can see that for each gender group, the mean value of the amount sold is significantly different across income levels.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Prepare a view that consists of the gender and the amount sold","message":["%sql","","CREATE OR REPLACE VIEW CUST_GENDER_AMOUNT_SOLD_V AS","SELECT CUST_GENDER, AMOUNT_SOLD"," FROM SH.CUSTOMERS C, SH.SALES S"," WHERE C.CUST_ID = S.CUST_ID"],"enabled":true,"result":{"startTime":1715728486822,"interpreter":"sql.low","endTime":1715728486897,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display data from CUST_GENDER_AMOUNT_SOLD_V","message":["%sql","","SELECT * FROM CUST_GENDER_AMOUNT_SOLD_V","FETCH FIRST 10 ROWS ONLY"],"enabled":true,"result":{"startTime":1715728486972,"interpreter":"sql.low","endTime":1715728487068,"results":[{"message":"CUST_GENDER\tAMOUNT_SOLD\nF\t1205.99\nM\t1250.25\nM\t1250.25\nF\t1250.25\nM\t1250.25\nM\t1250.25\nM\t1250.25\nF\t1250.25\nM\t1250.25\nM\t1210.21\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using Kolmogorov-Smirnov test","message":["%md","","#### Use a Kolmogorov-Smirnov test to compare whether two samples come from the same population","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_KS_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_KS_TEST.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_KS_TEST.html <\/a>","","Kolmogorov-Smirnov test compares two samples to test whether they are from the same population or from populations that have the same distribution. It does not assume that the population from which the samples were taken is normally distributed. The null hypothesis is that the two groups of data come from the same population or distribution. If the p-value < 0.05, then we reject the null hypothesis and determine that the two groups of data come from the different populations with more than 95% confidence.","","For more details and background on K-S tests, see <a href=\"https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test');\"> https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test <\/a>","","In the following example, we check whether the distributions of the amount sold by two gender groups is different in distribution with statistical significance."],"enabled":true,"result":{"startTime":1715728487143,"interpreter":"md.low","endTime":1715728487201,"results":[{"message":"<h4 id=\"use-a-kolmogorov-smirnov-test-to-compare-whether-two-samples-come-from-the-same-population\">Use a Kolmogorov-Smirnov test to compare whether two samples come from the same population<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_KS_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_KS_TEST.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_KS_TEST.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_KS_TEST.html<\/a> <\/a><\/p>\n<p>Kolmogorov-Smirnov test compares two samples to test whether they are from the same population or from populations that have the same distribution. It does not assume that the population from which the samples were taken is normally distributed. The null hypothesis is that the two groups of data come from the same population or distribution. If the p-value < 0.05, then we reject the null hypothesis and determine that the two groups of data come from the different populations with more than 95% confidence.<\/p>\n<p>For more details and background on K-S tests, see <a href=\"https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test');\"> <a href=\"https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test\">https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test<\/a> <\/a><\/p>\n<p>In the following example, we check whether the distributions of the amount sold by two gender groups is different in distribution with statistical significance.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Kolmogorov-Smirnov test - determine if distributions of amount sold by two gender groups are statistically different","message":["%sql","","SELECT ROUND(STATS_KS_TEST(CUST_GENDER, AMOUNT_SOLD, 'STATISTIC'),5) KS_STATISTIC,"," ROUND(STATS_KS_TEST(CUST_GENDER, AMOUNT_SOLD),5) P_VALUE"," FROM CUST_GENDER_AMOUNT_SOLD_V"],"enabled":true,"result":{"startTime":1715728487278,"interpreter":"sql.low","endTime":1715728487846,"results":[{"message":"KS_STATISTIC\tP_VALUE\n0.00384\t0.00408\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Conclusion of Kolmogorov-Smirnov test","message":["%md","","Since the p-value < 0.05, we reject the null hypothesis that the distributions of two gender groups are the same. Kolmogorov-Smirnov test result shows that the difference of distributions of two gender groups is significant at the more than 95% confidence. "],"enabled":true,"result":{"startTime":1715728487928,"interpreter":"md.low","endTime":1715728487989,"results":[{"message":"<p>Since the p-value < 0.05, we reject the null hypothesis that the distributions of two gender groups are the same. Kolmogorov-Smirnov test result shows that the difference of distributions of two gender groups is significant at the more than 95% confidence.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using Mann Whitney test","message":["%md","","","#### Use a Mann Whitney test to check whether two populations have the same distribution function","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_MW_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_MW_TEST.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_MW_TEST.html <\/a>","","For more details and background on the Mann Whitney test, see <a href=\"https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test');\"> https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test <\/a>","","It compares two independent samples to test the null hypothesis that two populations have the same distribution function against the alternative hypothesis that the two distribution functions are different."],"enabled":true,"result":{"startTime":1715728488063,"interpreter":"md.low","endTime":1715728488121,"results":[{"message":"<h4 id=\"use-a-mann-whitney-test-to-check-whether-two-populations-have-the-same-distribution-function\">Use a Mann Whitney test to check whether two populations have the same distribution function<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_MW_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_MW_TEST.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_MW_TEST.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_MW_TEST.html<\/a> <\/a><\/p>\n<p>For more details and background on the Mann Whitney test, see <a href=\"https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test');\"> <a href=\"https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test\">https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test<\/a> <\/a><\/p>\n<p>It compares two independent samples to test the null hypothesis that two populations have the same distribution function against the alternative hypothesis that the two distribution functions are different.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Mann Whitney Test - determine if distributions of amount sold by two gender groups are statistically different","message":["%sql","","SELECT ROUND(STATS_MW_TEST(CUST_GENDER, CUST_CREDIT_LIMIT, 'STATISTIC'),2) Z_STATISTIC,"," ROUND(STATS_MW_TEST(CUST_GENDER, CUST_CREDIT_LIMIT, 'TWO_SIDED_SIG', 'F'),2) TWO_SIDED_P_VALUE"," FROM SH.CUSTOMERS C, SH.SALES S"," WHERE C.CUST_ID = S.CUST_ID;"],"enabled":true,"result":{"startTime":1715728488199,"interpreter":"sql.low","endTime":1715728488383,"results":[{"message":"Z_STATISTIC\tTWO_SIDED_P_VALUE\n-0.78\t0.43\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Conclusion of Mann Whitney Test","message":["%md","","Since the p-value is much larger than 0.05, we do not reject the hypothesis that the distributions of the amount sold in the two groups is the same. This means that the difference observed from the data is not significant. "],"enabled":true,"result":{"startTime":1715728488459,"interpreter":"md.low","endTime":1715728488517,"results":[{"message":"<p>Since the p-value is much larger than 0.05, we do not reject the hypothesis that the distributions of the amount sold in the two groups is the same. This means that the difference observed from the data is not significant.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Create a view that contains income level and the amount sold to men and women","message":["%sql","","CREATE OR REPLACE VIEW INCOME_GENDER_SOLD_V AS","SELECT SUBSTR(CUST_INCOME_LEVEL,1,22) INCOME_LEVEL, ","\tROUND(AVG(DECODE(CUST_GENDER,'M',AMOUNT_SOLD,NULL)),2) SOLD_TO_MEN, ","\tROUND(AVG(DECODE(CUST_GENDER,'F',AMOUNT_SOLD,NULL)),2) SOLD_TO_WOMEN"," FROM SH.CUSTOMERS C, SH.SALES S "," WHERE C.CUST_ID=S.CUST_ID "," AND SUBSTR(CUST_INCOME_LEVEL,1,22) IS NOT NULL"," GROUP BY CUST_INCOME_LEVEL"],"enabled":true,"result":{"startTime":1715728488590,"interpreter":"sql.low","endTime":1715728488669,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Display the view","message":["%sql","","SELECT * ","FROM INCOME_GENDER_SOLD_V"],"enabled":true,"result":{"startTime":1715728488745,"interpreter":"sql.low","endTime":1715728489122,"results":[{"message":"INCOME_LEVEL\tSOLD_TO_MEN\tSOLD_TO_WOMEN\nE: 90,000 - 109,999\t103.4\t101.61\nJ: 190,000 - 249,999\t108.04\t115.34\nD: 70,000 - 89,999\t106.63\t110.47\nL: 300,000 and above\t120.97\t112.22\nC: 50,000 - 69,999\t105.63\t110.13\nG: 130,000 - 149,999\t108.88\t107.31\nH: 150,000 - 169,999\t110.99\t107.15\nB: 30,000 - 49,999\t102.6\t109.83\nI: 170,000 - 189,999\t102.81\t107.44\nF: 110,000 - 129,999\t106.76\t105.98\nA: Below 30,000\t105.28\t99.43\nK: 250,000 - 299,999\t112.38\t108.2\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using Wilcoxon Signed Rank Test","message":["%md","","#### Use Wilcoxon Signed Rank test to determine whether the median of the differences between the samples are the same","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_WSR_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_WSR_TEST.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_WSR_TEST.html <\/a>","","Wilcoxon Signed Ranks test of paired samples to determine whether the median of the differences between the samples is significantly different from zero. The absolute values of the differences are ordered and assigned ranks. Then the null hypothesis states that the sum of the ranks of the positive differences is equal to the sum of the ranks of the negative differences.","","For more information and background on Wilcoxon Signed Rank tests, see <a href=\"https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test');\"> https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test <\/a>","","In the following example, we go through each income level and obtain average amount sold to each gender group. We are interested to know whether there is a difference between the amount sold to men or women for each income level. WSR test focuses on the median of the differences of the amount sold in the two gender groups and do a hypothesis testing on whether the median is significantly different. The null hypothesis is that the median is the same. "],"enabled":true,"result":{"startTime":1715728489200,"interpreter":"md.low","endTime":1715728489260,"results":[{"message":"<h4 id=\"use-wilcoxon-signed-rank-test-to-determine-whether-the-median-of-the-differences-between-the-samples-are-the-same\">Use Wilcoxon Signed Rank test to determine whether the median of the differences between the samples are the same<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_WSR_TEST.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_WSR_TEST.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_WSR_TEST.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/STATS_WSR_TEST.html<\/a> <\/a><\/p>\n<p>Wilcoxon Signed Ranks test of paired samples to determine whether the median of the differences between the samples is significantly different from zero. The absolute values of the differences are ordered and assigned ranks. Then the null hypothesis states that the sum of the ranks of the positive differences is equal to the sum of the ranks of the negative differences.<\/p>\n<p>For more information and background on Wilcoxon Signed Rank tests, see <a href=\"https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test');\"> <a href=\"https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test\">https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test<\/a> <\/a><\/p>\n<p>In the following example, we go through each income level and obtain average amount sold to each gender group. We are interested to know whether there is a difference between the amount sold to men or women for each income level. WSR test focuses on the median of the differences of the amount sold in the two gender groups and do a hypothesis testing on whether the median is significantly different. The null hypothesis is that the median is the same.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Wilcoxon Signed Ranks Test - determine if median of difference between amount sold to men and amount sold to women is statistically different from zero ","message":["%sql","","SELECT ROUND(STATS_WSR_TEST(SOLD_TO_MEN, SOLD_TO_WOMEN, 'STATISTIC'),2) Z_STATISTIC,"," ROUND(STATS_WSR_TEST(SOLD_TO_MEN, SOLD_TO_WOMEN, 'TWO_SIDED_SIG'),2) TWO_SIDED_P_VALUE"," FROM INCOME_GENDER_SOLD_V"],"enabled":true,"result":{"startTime":1715728489334,"interpreter":"sql.low","endTime":1715728489531,"results":[{"message":"Z_STATISTIC\tTWO_SIDED_P_VALUE\n-0.12\t0.91\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Conclusion of Wilcoxon Signed Rank Test","message":["%md","","","The p-value is much greater than 0.05. We do not reject the null hypothesis. This means that the difference between the median of the amount sold to two gender groups is not significant. "],"enabled":true,"result":{"startTime":1715728489608,"interpreter":"md.low","endTime":1715728489669,"results":[{"message":"<p>The p-value is much greater than 0.05. We do not reject the null hypothesis. This means that the difference between the median of the amount sold to two gender groups is not significant.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using Pearson's correlation","message":["%md","","#### Using Pearson's correlation coefficient to measure the correlation between two columns ","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR.html <\/a>","","This is most popular correlation coefficient and widely used for measuring correlation of a set of number pairs.","For more information and background on Pearson's correlation, see <a href=\"https://en.wikipedia.org/wiki/Pearson_correlation_coefficient\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Pearson_correlation_coefficient');\"> https://en.wikipedia.org/wiki/Pearson_correlation_coefficient <\/a>"],"enabled":true,"result":{"startTime":1715728489744,"interpreter":"md.low","endTime":1715728489805,"results":[{"message":"<h4 id=\"using-pearsons-correlation-coefficient-to-measure-the-correlation-between-two-columns\">Using Pearson's correlation coefficient to measure the correlation between two columns<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR.html<\/a> <\/a><\/p>\n<p>This is most popular correlation coefficient and widely used for measuring correlation of a set of number pairs.\nFor more information and background on Pearson's correlation, see <a href=\"https://en.wikipedia.org/wiki/Pearson_correlation_coefficient\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Pearson_correlation_coefficient');\"> <a href=\"https://en.wikipedia.org/wiki/Pearson_correlation_coefficient\">https://en.wikipedia.org/wiki/Pearson_correlation_coefficient<\/a> <\/a><\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Compute Pearson's correlation between amount sold to the two gender groups","message":["%sql","","SELECT ROUND(CORR(SOLD_TO_MEN, SOLD_TO_WOMEN),2) CORRELATION_COEF","FROM INCOME_GENDER_SOLD_V"],"enabled":true,"result":{"startTime":1715728489880,"interpreter":"sql.low","endTime":1715728490107,"results":[{"message":"CORRELATION_COEF\n0.38\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using Spearman's rho correlation coefficient","message":["%md","","#### Using Spearman's rho correlation coefficient to measure the correlation between two columns","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html <\/a>","","Spearman's rho correlation coefficient can find the nonlinear relationship between two variables by focusing the rank of each variables. The Spearman's rho correlation also provides a significance indicator like the p-value. If p-value is small (< 0.05), then it means that there are significant corrleation between the two groups. ","","For more details and background on Spearman's rho correlation, see <a href=\"https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient');\"> https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient <\/a> ","In the following example, we compute Spearman's rho coefficient between the income level and the amount sold to men and women. We check if the correlation between the amount sold and their income level is significant for men and women. "],"enabled":true,"result":{"startTime":1715728490182,"interpreter":"md.low","endTime":1715728490249,"results":[{"message":"<h4 id=\"using-spearmans-rho-correlation-coefficient-to-measure-the-correlation-between-two-columns\">Using Spearman's rho correlation coefficient to measure the correlation between two columns<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html<\/a> <\/a><\/p>\n<p>Spearman's rho correlation coefficient can find the nonlinear relationship between two variables by focusing the rank of each variables. The Spearman's rho correlation also provides a significance indicator like the p-value. If p-value is small (< 0.05), then it means that there are significant corrleation between the two groups.<\/p>\n<p>For more details and background on Spearman's rho correlation, see <a href=\"https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient');\"> <a href=\"https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient\">https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient<\/a> <\/a>\nIn the following example, we compute Spearman's rho coefficient between the income level and the amount sold to men and women. We check if the correlation between the amount sold and their income level is significant for men and women.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Compute Spearman's rho correlation coefficient for income level and the amount sold to men, income level and the amount sold to women","message":["%sql","","SELECT ROUND(CORR_S(INCOME_LEVEL, SOLD_TO_MEN, 'COEFFICIENT'),2) MEN_COEFFICIENT, "," ROUND(CORR_S(INCOME_LEVEL, SOLD_TO_MEN, 'TWO_SIDED_SIG'),2) MEN_TWO_SIDED_SIG,"," ROUND(CORR_S(INCOME_LEVEL, SOLD_TO_WOMEN, 'COEFFICIENT'),2) WOMEN_COEFFICIENT, "," ROUND(CORR_S(INCOME_LEVEL, SOLD_TO_WOMEN, 'TWO_SIDED_SIG'),2) WOMEN_TWO_SIDED_SIG","FROM INCOME_GENDER_SOLD_V"],"enabled":true,"result":{"startTime":1715728490327,"interpreter":"sql.low","endTime":1715728490556,"results":[{"message":"MEN_COEFFICIENT\tMEN_TWO_SIDED_SIG\tWOMEN_COEFFICIENT\tWOMEN_TWO_SIDED_SIG\n0.71\t0.01\t0.38\t0.22\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Conclusion of Spearman's rho correlation","message":["%md","","For the correlation between the income level and the amount sold to men, the TWO_SIDED_SIG value is very small, which indicates the correlation between the income level and the amount sold to men has significant correlation. But for women, such a relationship is not significant. "],"enabled":true,"result":{"startTime":1715728490633,"interpreter":"md.low","endTime":1715728490696,"results":[{"message":"<p>For the correlation between the income level and the amount sold to men, the TWO_SIDED_SIG value is very small, which indicates the correlation between the income level and the amount sold to men has significant correlation. But for women, such a relationship is not significant.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Using Kendall's tau-b correlation","message":["%md","","","#### Using Kendall's tau-b correlation to measure the correlation between two columns","","See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html');\"> https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html <\/a>","","Kendall's tau-b correlation coefficient also reveals the nonlinear relationship between two variables. To calculate the coefficient, the number of concordant and discordant pairs is computed. A pair of observations is concordant if the observation with the larger x also has a larger value of y. A pair of observations is discordant if the observation with the larger x has a smaller y. ","The Kendall's tau-b also provides a significance indicator like the p-value. If p-value is small (< 0.05), then it means that there are significant corrleation between the two groups. ","For more details and background on Kendall's tau-b correlation, see <a href=\"https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient');\"> https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient <\/a> ","","In the following example, we compute Kendall's tau-b coefficient between the income level and the amount sold to men and women. We check if the correlation between the amount sold and their income level is significant for men and women. "],"enabled":true,"result":{"startTime":1715728490774,"interpreter":"md.low","endTime":1715728490840,"results":[{"message":"<h4 id=\"using-kendalls-tau-b-correlation-to-measure-the-correlation-between-two-columns\">Using Kendall's tau-b correlation to measure the correlation between two columns<\/h4>\n<p>See documentation at <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html\" onclick=\"return ! window.open('https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html');\"> <a href=\"https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html\">https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CORR_A.html<\/a> <\/a><\/p>\n<p>Kendall's tau-b correlation coefficient also reveals the nonlinear relationship between two variables. To calculate the coefficient, the number of concordant and discordant pairs is computed. A pair of observations is concordant if the observation with the larger x also has a larger value of y. A pair of observations is discordant if the observation with the larger x has a smaller y.\nThe Kendall's tau-b also provides a significance indicator like the p-value. If p-value is small (< 0.05), then it means that there are significant corrleation between the two groups.\nFor more details and background on Kendall's tau-b correlation, see <a href=\"https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient\" onclick=\"return ! window.open('https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient');\"> <a href=\"https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient\">https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient<\/a> <\/a><\/p>\n<p>In the following example, we compute Kendall's tau-b coefficient between the income level and the amount sold to men and women. We check if the correlation between the amount sold and their income level is significant for men and women.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Kendall's tau-b correlation coefficient for income level and amount sold to men, and income level and amount sold to women","message":["%sql","","SELECT ROUND(CORR_K(INCOME_LEVEL, SOLD_TO_MEN, 'COEFFICIENT'),2) MEN_COEFFICIENT, "," ROUND(CORR_K(INCOME_LEVEL, SOLD_TO_MEN, 'TWO_SIDED_SIG'),2) MEN_TWO_SIDED_SIG,"," ROUND(CORR_K(INCOME_LEVEL, SOLD_TO_WOMEN, 'COEFFICIENT'),2) WOMEN_COEFFICIENT, "," ROUND(CORR_K(INCOME_LEVEL, SOLD_TO_WOMEN, 'TWO_SIDED_SIG'),2) WOMEN_TWO_SIDED_SIG","FROM INCOME_GENDER_SOLD_V"],"enabled":true,"result":{"startTime":1715728490919,"interpreter":"sql.low","endTime":1715728491106,"results":[{"message":"MEN_COEFFICIENT\tMEN_TWO_SIDED_SIG\tWOMEN_COEFFICIENT\tWOMEN_TWO_SIDED_SIG\n0.61\t0.01\t0.36\t0.1\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Conclusion for Kendall's tau-b correlation","message":["%md","","For the correlation between the income level and the amount sold to men, the TWO_SIDED_SIG value is very small, which indicates the correlation between the income level and the amount sold to men has significant correlation. But for women, such a relationship is not significant."],"enabled":true,"result":{"startTime":1715728491184,"interpreter":"md.low","endTime":1715728491242,"results":[{"message":"<p>For the correlation between the income level and the amount sold to men, the TWO_SIDED_SIG value is very small, which indicates the correlation between the income level and the amount sold to men has significant correlation. But for women, such a relationship is not significant.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","## End of script"],"enabled":true,"result":{"startTime":1715728491318,"interpreter":"md.low","endTime":1715728491377,"results":[{"message":"<h2 id=\"end-of-script\">End of script<\/h2>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":[],"enabled":true,"result":{"startTime":1715728491604,"interpreter":"md.low","endTime":1715728491664,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":true,"dynamicFormParams":null,"row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"}],"version":"6","snapshot":false,"tags":null}]